
CREATE TABLE FABRICACION
(
	ID_FAB               integer IDENTITY (1,1) ,
	ORDEN_FAB            varchar(20)  NULL ,
	FECHA_FAB            datetime  NULL ,
	PESO_FAB             decimal(18,2)  NULL ,
	BULTOS_FAB           integer  NULL ,
	FECHA_ALTA_FAB       datetime  NULL 
	CONSTRAINT CURRENT_TIMESTAMP_303545033
		 DEFAULT  CURRENT_TIMESTAMP,
	ID_PRO               integer  NOT NULL ,
	ID_TUR               integer  NOT NULL 
)
go


ALTER TABLE FABRICACION
	ADD CONSTRAINT XPKFABRICACION PRIMARY KEY  CLUSTERED (ID_FAB ASC)
go


CREATE TABLE TURNO
(
	ID_TUR               integer IDENTITY (1,1) ,
	NOMBRE_TUR           varchar(100)  NULL ,
	INICIO_TUR           datetime  NULL ,
	FIN_TUR              datetime  NULL 
)
go


ALTER TABLE TURNO
	ADD CONSTRAINT XPKTURNO PRIMARY KEY  CLUSTERED (ID_TUR ASC)
go



ALTER TABLE FABRICACION
	ADD CONSTRAINT R_15 FOREIGN KEY (ID_PRO) REFERENCES PRODUCTO(ID_PRO)
		ON DELETE NO ACTION
		ON UPDATE NO ACTION
go

ALTER TABLE FABRICACION
	ADD CONSTRAINT R_16 FOREIGN KEY (ID_TUR) REFERENCES TURNO(ID_TUR)
		ON DELETE NO ACTION
		ON UPDATE NO ACTION
go
